//
//  HTTPTool.h
//  HeartTravel
//
//  Created by dlios on 15-6-29.
//  Copyright (c) 2015年 lanou3g.com 蓝鸥科技. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

typedef NS_ENUM(NSInteger, HTTPStyle) {
    
    HTTP,
    JSON,
    XML
};

typedef NS_ENUM(NSInteger, RequestBodyStyle) {
    
    BodyHTTP,
    BodyJSON
};

@interface HTTPTool : NSObject

/**
 *  get请求
 *
 *  @param url     请求的网址
 *  @param body    网络请求携带的Body
 *  @param style   请求返回的数据
 *  @param success 成功调用Block
 *  @param failure 失败调用Block
 */
+ (void)get:(NSString *)url
       body:(id)body
 httpResult:(HTTPStyle)style
    success:(void(^)(id result))success
    failure:(void(^)(NSError *error))failure;

//post请求

/**
 *  post网络请求
 *
 *  @param url       请求的URL
 *  @param body      网络请求携带的Body
 *  @param style     请求返回的数据类型那个
 *  @param bodyStyle post请求body的数据类型
 *  @param success   成功调用Block
 *  @param failure   失败调用Block
 */
+ (void)post:(NSString *)url
        body:(id)body
 httpResult:(HTTPStyle)style
requestBodyStyle:(RequestBodyStyle)bodyStyle
     success:(void(^)(id result))success
     failure:(void(^)(NSError *error))failure;
@end
